DBPATH=/tmp/cs6310_ds3t4_pgdata

all:
	javac data/*.java util/*.java prj2/*.java prj2/ui/*.java prj2/exceptions/*.java

lennon:
	/usr/local/java/bin/javac data/*.java util/*.java prj2/*.java prj2/ui/*.java prj2/exceptions/*.java

testdata:
	java data.Database

clean:
	rm -rf data/*.class util/*.class prj2/*.class prj2/ui/*.class prj2/exceptions/*.class

createdb:
	echo Creating database at $(DBPATH)
	initdb -D $(DBPATH)
	pg_ctl start -D $(DBPATH) -o "-p 9879 -h localhost"
	echo Waiting for database to start
	sleep 5	
	psql -p 9879 template1 < sql/setup.sql
	pg_ctl stop -D $(DBPATH)
	cp -f sql/pg_hba.conf $(DBPATH)/
	cp -f sql/postgresql.conf $(DBPATH)/

deletedb:
	rm -rf $(DBPATH)

rundb:
	postmaster -D $(DBPATH)
